<template>
  <div class="box">
    <h3>Son</h3>
    <p>学校： {{school}}</p>
    <p>地址： {{address}}</p>
    <!-- <p><button @click="getName(school)">告诉父亲学校的名字</button></p> -->
    <p><button @click="sendName">告诉父亲学校的名字</button></p>

    <p><button @click="sendAddress">告诉父亲学校的地址</button></p>
  </div>
</template>

<script>
export default {
    name:'Son',
    props:['getName'],
    data(){
        return {
            address:'宏福科技园',
            school:'尚硅谷'
        }
    },
    methods:{
        sendName(){
            this.$emit('get-school-name', this.school)
        },
        sendAddress(){
            this.$emit('get-school-address', this.address)
        }
    }
}
</script>

<style>
.box{
    width:400px;
    height:200px;
    background-color: beige;
}
</style>